import request from "../utils/request.js";

export function getRoleList(currentPage, pageSize,queryParams){
    return request({
        url: '/role/list',
        method: 'get',
        params: {
            currentPage,
            pageSize,
            ...queryParams
        }
    })
}

export function changeStatus(roleId) {
    return request({
        url: '/role/change',
        method: 'put',
        params:{
            roleId
        }
    })
}

export function getRole(roleId) {
    return request({
        url: '/role/' + roleId,
        method: 'get'
    })
}

export function getRoleSelect(){
    return request({
        url: '/role/select',
        method: 'get',
    })
}
export function getRoleAndMenus(roleId){
    return request({
        url: '/role/menus',
        method: 'get',
        params: {
            roleId
        }
    })
}


export function addRoleAndMenus(role){
    return request({
        url: '/role',
        method: 'post',
        data: {
            ...role
        }
    })
}

export function updateRoleAndMenus(role){
    return request({
        url: '/role',
        method: 'put',
        data: {
            ...role
        }
    })
}

export function deleteRole(ids){
    return request({
        url: '/role/' + ids,
        method: 'delete',
    })
}

